<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sj:head jqueryui="true" jquerytheme="redmond"></sj:head>
<script type="text/javascript">
function onButtonClick(){
	window.location = "premiseCreateAction.action";
}
function onClickCreate() {
	 window.location = "premiseCreateAction.action";
}
$.subscribe('rowselect', function(event, data) {
	/* var grid = event.originalEvent.grid;
	var sel_id = grid.jqGrid('getGridParam', 'selrow');
	var name = grid.jqGrid('getCell', sel_id, 'name');
	
	window.location="trustRegionDetailPageAction.action"; */
	var grid = event.originalEvent.grid;
	var sel_id = grid.jqGrid('getGridParam', 'selrow');
	var isActive = grid.jqGrid('getCell', sel_id, 'status');	
	if(isActive == "false"){
		alert("Do you want to make this Geography active?");	
	}	
	else{
		var premiseId = grid.jqGrid('getCell', sel_id, 'premiseId');
		var locationName = grid.jqGrid('getCell', sel_id, 'locationName');
		var postCode = grid.jqGrid('getCell', sel_id, 'postCode');
		var address1 = grid.jqGrid('getCell', sel_id, 'address1');

	window.location="premiseAdmendAction.action?locationName="+locationName+"&postCode="+postCode+"&address1="+address1+"&premiseId="+premiseId;
 		
	}
});
</script>
</head>
<body>
<h3>Premise List</h3>
<div class="type-button">		
		<sj:submit id="formSubmit2" onclick="onClickCreate()" value="Create"
			indicator="indicator" button="true" />
	</div>
<s:form theme="simple" action="premiseAdmendAction">
	<tr>
		<td><a href="<s:url action="servicesAllSearch"/>" >All</a></td>
		<td><a href="<s:url action="services09Search"/>" >0-9</a></td>
		<td><a href="<s:url action="servicesAESearch"/>" >A B C D E</a></td>
		<td><a href="<s:url action="servicesFJSearch"/>" >F G H I J</a></td>
		<td><a href="<s:url action="servicesKNSearch"/>" >K L M N</a></td>
		<td><a href="<s:url action="servicesORSearch"/>" >O P  Q R</a></td>
		<td><a href="<s:url action="servicesSVSearch"/>" >S T U V</a></td>
		<td><a href="<s:url action="servicesWZSearch"/>" >W X Y Z</a></td>
		
		<td> <s:checkbox name="includeInactive"> Include In-active </s:checkbox> </td>
	</tr>
	<sj:dialog id="mybuttondialog"
				buttons="{ 
				    		'OK':function() { okButton(); },
				    		'Cancel':function() { cancelButton(); } 
				    		}"
					autoOpen="false" modal="true" title="Dialog with Buttons">
				     Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque.
				     Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. 
				     Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. 
				     Vestibulum a velit eu ante scelerisque vulputate.
		    </sj:dialog>
	<s:url id="getPremiseUrl" action="PremiseListAction" />
	<sjg:grid id="gridtable" caption="Customer Examples" dataType="json"
		href="%{getPremiseUrl}" pager="true" gridModel="gridModel"
		rowNum="15" rownumbers="true" onSelectRowTopics="rowselect"> 
		<sjg:gridColumn name="premiseId" index="premiseId" title="Premise Id" sortable="false" hidden="true"/>
		<sjg:gridColumn name="locationName" index="locationName" title="Location Name" sortable="false" />
		<sjg:gridColumn name="address1" index="address1" title="Address Lin1" sortable="false" />
		<sjg:gridColumn name="postCode" index="postCode" title="PostCode" sortable="false" />
		<sjg:gridColumn name="isNewShop" index="isNewShop"  title="Is Active?" sortable="false" />
	</sjg:grid>
</s:form>
</body>
</html>